﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:skin="clr-namespace:UBCon.Controls.SkinManagers"
                    xmlns:ubcc="clr-namespace:UBCon.Controls">


    <BooleanToVisibilityConverter x:Key="BooleanConverter"/>

    <!--================================ButtonChrome Template And Style==============================================-->
    <ControlTemplate x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type ubcc:ButtonChrome}, ResourceId=ButtonChromeTemplate}"
                     TargetType="{x:Type ubcc:ButtonChrome}">
        <Grid x:Name="PART_Root" Height="{TemplateBinding Height}" >
            <Border   x:Name="PART_DefaultButton"
                      CornerRadius="{TemplateBinding CornerRadius}"
                      Background="{TemplateBinding Background}" 
                      BorderThickness="{TemplateBinding BorderThickness}"
                      BorderBrush="{TemplateBinding BorderBrush}" Margin="0" />
            <Border x:Name="PART_HoverButton" 
                    Opacity="0" 
                    BorderThickness="{TemplateBinding BorderThickness}"
                    BorderBrush="{TemplateBinding MouseOverBorderBrush}" 
                    Focusable="False" 
                    Margin="0" CornerRadius="{TemplateBinding CornerRadius}"
                    Background="{TemplateBinding MouseOverBackgroundBrush}"/>
            <Border x:Name="PART_PressedButton"
                    Opacity="0" 
                    BorderThickness="{TemplateBinding BorderThickness}"
                    BorderBrush="{TemplateBinding PressedBorderBrush}" 
                    Focusable="False" 
                    Margin="0" 
                    CornerRadius="{TemplateBinding CornerRadius}"
                    Background="{TemplateBinding PressedBackgroundBrush}"/>
            <ContentPresenter Margin="{TemplateBinding Padding}" 
                              Content="{TemplateBinding Content}" 
                              HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" 
                              VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
        </Grid>
        <ControlTemplate.Triggers>
            <Trigger Property="RenderMouseOver" Value="True" >
                <Setter Property="Opacity" Value="0" TargetName="PART_PressedButton"/>
                <Setter Property="Opacity" Value="1" TargetName="PART_HoverButton" />
            </Trigger>
            <Trigger Property="RenderPressed" Value="True">
                <Setter Property="Opacity" Value="0" TargetName="PART_DefaultButton"/>
                <Setter Property="Opacity" Value="0" TargetName="PART_HoverButton"/>
                <Setter Property="Opacity" Value="1" TargetName="PART_PressedButton"/>
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <Style x:Key="{x:Type ubcc:ButtonChrome}" TargetType="{x:Type ubcc:ButtonChrome}">
        <Setter Property="Background" Value="{DynamicResource {ComponentResourceKey TypeInTargetAssembly={x:Type skin:SkinManager}, ResourceId=TransparentBrush}}"/>
        <Setter Property="Template" Value="{DynamicResource ResourceKey={ComponentResourceKey TypeInTargetAssembly={x:Type ubcc:ButtonChrome}, ResourceId=ButtonChromeTemplate}}"/>
        <Setter Property="BorderBrush" Value="{DynamicResource ResourceKey={ComponentResourceKey TypeInTargetAssembly={x:Type skin:SkinManager}, ResourceId=SelectedBorderBrush}}" />
        <Setter Property="InnerBorderBrush" Value="{DynamicResource ResourceKey={ComponentResourceKey TypeInTargetAssembly={x:Type skin:SkinManager}, ResourceId=TransparentBrush}}" />
        <Setter Property="MouseOverBorderBrush" Value="{DynamicResource {ComponentResourceKey TypeInTargetAssembly={x:Type skin:SkinManager}, ResourceId=MouseOverBorderBrush}}" />
        <Setter Property="MouseOverBackgroundBrush" Value="{DynamicResource {ComponentResourceKey TypeInTargetAssembly={x:Type skin:SkinManager}, ResourceId=MouseOverBackgroundBrush}}"/>
        <Setter Property="PressedBorderBrush" Value="{DynamicResource {ComponentResourceKey TypeInTargetAssembly={x:Type skin:SkinManager}, ResourceId=PressedBorderBrush}}" />
        <Setter Property="PressedBackgroundBrush" Value="{DynamicResource {ComponentResourceKey TypeInTargetAssembly={x:Type skin:SkinManager}, ResourceId=PressedBackgroundBrush}}"/>
        <Setter Property="VerticalContentAlignment" Value="Stretch"/>
        <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
        <Setter Property="BorderThickness" Value="0"/>
        <Setter Property="InnerBorderThickness" Value="0"/>
        <Setter Property="CornerRadius" Value="0"/>
        <Setter Property="InnerBorderCornerRadius" Value="0"/>
    </Style>

    <!--================================ComboBoxItem Template and Style==============================================-->
    <Style x:Key="{x:Type ubcc:ComboBoxItem}" TargetType="{x:Type ubcc:ComboBoxItem}">
        <Setter Property="SnapsToDevicePixels" Value="True"/>
        <Setter Property="Padding" Value="4,1"/>
        <Setter Property="HorizontalContentAlignment" Value="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type ItemsControl}}}"/>
        <Setter Property="VerticalContentAlignment" Value="{Binding VerticalContentAlignment, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type ItemsControl}}}"/>
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="BorderBrush" Value="Transparent"/>
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="FocusVisualStyle">
            <Setter.Value>
                <Style>
                    <Setter Property="Control.Template">
                        <Setter.Value>
                            <ControlTemplate>
                                <Rectangle Margin="2" 
                                           SnapsToDevicePixels="True" 
                                           Stroke="{DynamicResource ResourceKey={ComponentResourceKey TypeInTargetAssembly={x:Type skin:SkinManager}, ResourceId=SelectedMenuBackgroundBrush}}" 
                                           StrokeThickness="1" 
                                           StrokeDashArray="1 2"/>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                </Style>
            </Setter.Value>
        </Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ubcc:ComboBoxItem}">
                    <Border x:Name="Bd" BorderBrush="{TemplateBinding BorderBrush}" 
                            BorderThickness="{TemplateBinding BorderThickness}" 
                            Background="{TemplateBinding Background}" 
                            Padding="{TemplateBinding Padding}" 
                            SnapsToDevicePixels="True">
                        <ContentPresenter/>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter Property="TextElement.Foreground" 
                                    TargetName="Bd" 
                                    Value="{DynamicResource ResourceKey={ComponentResourceKey TypeInTargetAssembly={x:Type skin:SkinManager}, ResourceId=GrayBrush}}"/>
                        </Trigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsSelected" Value="False"/>
                                <Condition Property="IsMouseOver" Value="True"/>
                                <Condition Property="IsKeyboardFocused" Value="False"/>
                            </MultiTrigger.Conditions>
                            <Setter Property="Background" 
                                    TargetName="Bd" 
                                    Value="{DynamicResource ResourceKey={ComponentResourceKey TypeInTargetAssembly={x:Type skin:SkinManager}, ResourceId=MouseOverBackgroundBrush}}"/>
                            <Setter Property="BorderBrush" 
                                    TargetName="Bd" 
                                    Value="{DynamicResource ResourceKey={ComponentResourceKey TypeInTargetAssembly={x:Type skin:SkinManager}, ResourceId=SelectedMenuBackgroundBrush}}"/>
                        </MultiTrigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsSelected" Value="True"/>
                                <Condition Property="IsMouseOver" Value="False"/>
                                <Condition Property="IsKeyboardFocused" Value="True"/>
                            </MultiTrigger.Conditions>
                            <Setter Property="Background" 
                                    TargetName="Bd"
                                    Value="{DynamicResource ResourceKey={ComponentResourceKey TypeInTargetAssembly={x:Type skin:SkinManager}, ResourceId=MouseOverBackgroundBrush}}"/>
                            <Setter Property="BorderBrush" 
                                    TargetName="Bd" 
                                    Value="{DynamicResource ResourceKey={ComponentResourceKey TypeInTargetAssembly={x:Type skin:SkinManager}, ResourceId=SelectedMenuBackgroundBrush}}"/>
                        </MultiTrigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsSelected" 
                                           Value="True"/>
                                <Condition Property="IsMouseOver" 
                                           Value="True"/>
                            </MultiTrigger.Conditions>
                            <Setter Property="Background" 
                                    TargetName="Bd" 
                                    Value="{DynamicResource ResourceKey={ComponentResourceKey TypeInTargetAssembly={x:Type skin:SkinManager}, ResourceId=MouseOverBackgroundBrush}}"/>
                            <Setter Property="BorderBrush" 
                                    TargetName="Bd" 
                                    Value="{DynamicResource ResourceKey={ComponentResourceKey TypeInTargetAssembly={x:Type skin:SkinManager}, ResourceId=SelectedMenuBackgroundBrush}}"/>
                        </MultiTrigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsSelected" Value="True"/>
                                <Condition Property="IsMouseOver" Value="False"/>
                                <Condition Property="IsKeyboardFocused" Value="False"/>
                            </MultiTrigger.Conditions>
                            <Setter Property="Background" 
                                    TargetName="Bd" 
                                    Value="{DynamicResource ResourceKey={ComponentResourceKey TypeInTargetAssembly={x:Type skin:SkinManager}, ResourceId=SelectedTabItemBrush}}"/>
                            <Setter Property="BorderBrush" 
                                    TargetName="Bd" 
                                    Value="{DynamicResource ResourceKey={ComponentResourceKey TypeInTargetAssembly={x:Type skin:SkinManager}, ResourceId=SelectedMenuBackgroundBrush}}"/>
                        </MultiTrigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsSelected" 
                                           Value="False"/>
                                <Condition Property="IsMouseOver" Value="False"/>
                                <Condition Property="IsKeyboardFocused" Value="True"/>
                            </MultiTrigger.Conditions>
                            <Setter Property="BorderBrush" 
                                    TargetName="Bd" 
                                    Value="{DynamicResource ResourceKey={ComponentResourceKey TypeInTargetAssembly={x:Type skin:SkinManager}, ResourceId=MouseOverMenuBackgroundBrush}}"/>
                        </MultiTrigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsSelected" Value="False"/>
                                <Condition Property="IsMouseOver" Value="True"/>
                                <Condition Property="IsKeyboardFocused" Value="True"/>
                            </MultiTrigger.Conditions>
                            <Setter Property="Background" 
                                    TargetName="Bd" 
                                    Value="{DynamicResource ResourceKey={ComponentResourceKey TypeInTargetAssembly={x:Type skin:SkinManager}, ResourceId=MouseOverBackgroundBrush}}"/>
                            <Setter Property="BorderBrush" 
                                    TargetName="Bd" 
                                    Value="{DynamicResource ResourceKey={ComponentResourceKey TypeInTargetAssembly={x:Type skin:SkinManager}, ResourceId=MouseOverBackgroundBrush}}"/>
                        </MultiTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--================================ComboBox Template and Style==============================================-->
    <ControlTemplate TargetType="{x:Type ubcc:UBConComboBox}" x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type ubcc:UBConComboBox}, ResourceId=EditableComboBoxTemplate}">
        <Grid x:Name="templateRoot"
              SnapsToDevicePixels="True">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="15"/>
            </Grid.ColumnDefinitions>
            <Popup x:Name="PART_Popup" 
                   Placement="Bottom"
                   PopupAnimation="None"
                   Grid.ColumnSpan="2" 
                   IsOpen="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" 
                   Margin="1"
                   VerticalOffset="-4.2"
                   AllowsTransparency="True">
                <Border x:Name="DropDownBorder" 
                             BorderThickness="1"
                             BorderBrush="{DynamicResource ResourceKey={ComponentResourceKey TypeInTargetAssembly={x:Type skin:SkinManager}, ResourceId=DropDownBorderBrush}}"
                             Margin="7"
                             Background="{DynamicResource ResourceKey={ComponentResourceKey TypeInTargetAssembly={x:Type skin:SkinManager}, ResourceId=WhiteBrush}}"
                             MaxHeight="{TemplateBinding MaxDropDownHeight}" 
                             MinWidth="{Binding ActualWidth, ElementName=templateRoot}">
                    <Border.RenderTransform>
                        <TranslateTransform />
                    </Border.RenderTransform>
                    <Grid VerticalAlignment="Top"
                              x:Name="PART_RibbonDropDownButtonResize"
                              MinHeight="32.0">
                        <Grid.RowDefinitions>
                            <RowDefinition />
                            <RowDefinition Height="Auto" />
                        </Grid.RowDefinitions>
                        <Border  Background="{DynamicResource ResourceKey={ComponentResourceKey TypeInTargetAssembly={x:Type skin:SkinManager}, ResourceId=WhiteBrush}}"
                                     Effect="{DynamicResource ResourceKey={ComponentResourceKey TypeInTargetAssembly={x:Type skin:SkinManager}, ResourceId=DropDownShadowEffect}}"
                                     Grid.RowSpan="2"/>
                        <ScrollViewer x:Name="DropDownScrollViewer"
                                       Margin="1">
                            <ItemsPresenter x:Name="ItemsPresenter" KeyboardNavigation.DirectionalNavigation="Contained" 
                                            SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                        </ScrollViewer>
                        <Thumb x:Name="PART_RibbonDropDownButtonThumb" 
                               Grid.Row="1" 
                               Focusable="False" 
                               Visibility="{Binding Path=UserCanResizeDropDown, RelativeSource={RelativeSource Mode=TemplatedParent}, Converter={StaticResource ResourceKey=BooleanConverter}}"
                               Height="7"
                               Style="{DynamicResource ResourceKey={ComponentResourceKey TypeInTargetAssembly={x:Type skin:SkinManager}, ResourceId=DefaulThumbStyle}}"/>
                    </Grid>
                </Border>
            </Popup>
            <ToggleButton x:Name="toggleButton" 
                          BorderBrush="{TemplateBinding BorderBrush}" 
                          BorderThickness="{TemplateBinding BorderThickness}" 
                          Background="{TemplateBinding Background}" 
                          Grid.ColumnSpan="2" 
                          IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}">
                <ToggleButton.Style>
                    <Style TargetType="{x:Type ToggleButton}">
                        <Setter Property="IsTabStop" Value="False"/>
                        <Setter Property="Focusable" Value="False"/>
                        <Setter Property="ClickMode" Value="Press"/>
                        <Setter Property="Template">
                            <Setter.Value>
                                <ControlTemplate TargetType="{x:Type ToggleButton}">
                                    <Border x:Name="templateRoot"
                                            BorderBrush="{TemplateBinding BorderBrush}" 
                                            BorderThickness="{TemplateBinding BorderThickness}" 
                                            SnapsToDevicePixels="True">
                                        <Border x:Name="splitBorder" 
                                                BorderBrush="Transparent" 
                                                BorderThickness="1" 
                                                HorizontalAlignment="Right"
                                                SnapsToDevicePixels="True"
                                                Width="15">
                                            <Path x:Name="Arrow" 
                                                  Data="M0,4 L 6,4 L 3,8 L 0,4" 
                                                  Fill="{DynamicResource ResourceKey={ComponentResourceKey TypeInTargetAssembly={x:Type skin:SkinManager}, ResourceId=DefaultForegroundBrush}}" 
                                                  HorizontalAlignment="Center" 
                                                  Margin="0, -3, 0, 0" 
                                                  VerticalAlignment="Center"/>
                                        </Border>
                                    </Border>
                                    <ControlTemplate.Triggers>
                                        <Trigger Property="IsMouseOver" Value="True">
                                            <Setter Property="Fill" 
                                                    TargetName="Arrow" 
                                                    Value="{DynamicResource ResourceKey={ComponentResourceKey TypeInTargetAssembly={x:Type skin:SkinManager}, ResourceId=BlackBrush}}"/>
                                            <Setter Property="BorderBrush" TargetName="templateRoot" Value="{DynamicResource ResourceKey={ComponentResourceKey TypeInTargetAssembly={x:Type skin:SkinManager}, ResourceId=PressedBackgroundBrush}}"/>
                                            <Setter Property="Background" TargetName="splitBorder" Value="{DynamicResource ResourceKey={ComponentResourceKey TypeInTargetAssembly={x:Type skin:SkinManager}, ResourceId=MouseOverBackgroundBrush}}"/>
                                            <Setter Property="BorderBrush" TargetName="splitBorder" Value="{DynamicResource ResourceKey={ComponentResourceKey TypeInTargetAssembly={x:Type skin:SkinManager}, ResourceId=PressedBackgroundBrush}}"/>
                                        </Trigger>
                                        <Trigger Property="IsChecked" Value="True">
                                            <Setter Property="Fill" TargetName="Arrow" Value="{DynamicResource ResourceKey={ComponentResourceKey TypeInTargetAssembly={x:Type skin:SkinManager}, ResourceId=BlackBrush}}"/>
                                            <Setter Property="BorderBrush" 
                                                    TargetName="templateRoot" 
                                                    Value="{DynamicResource ResourceKey={ComponentResourceKey TypeInTargetAssembly={x:Type skin:SkinManager}, ResourceId=PressedBackgroundBrush}}"/>
                                            <Setter Property="Background" TargetName="splitBorder" Value="{DynamicResource ResourceKey={ComponentResourceKey TypeInTargetAssembly={x:Type skin:SkinManager}, ResourceId=PressedBackgroundBrush}}"/>
                                            <Setter Property="BorderBrush" TargetName="splitBorder" Value="{DynamicResource ResourceKey={ComponentResourceKey TypeInTargetAssembly={x:Type skin:SkinManager}, ResourceId=PressedBackgroundBrush}}"/>
                                        </Trigger>
                                        <Trigger Property="IsEnabled" Value="False">
                                            <Setter Property="Fill" TargetName="Arrow" 
                                                    Value="{DynamicResource ResourceKey={ComponentResourceKey TypeInTargetAssembly={x:Type skin:SkinManager}, ResourceId=LightGrayBrush}}"/>
                                            <Setter Property="BorderBrush" 
                                                    TargetName="templateRoot" Value="{DynamicResource ResourceKey={ComponentResourceKey TypeInTargetAssembly={x:Type skin:SkinManager}, ResourceId=LightGrayBrush}}"/>
                                            <Setter Property="Background" 
                                                    TargetName="splitBorder" 
                                                    Value="{DynamicResource ResourceKey={ComponentResourceKey TypeInTargetAssembly={x:Type skin:SkinManager}, ResourceId=TransparentBrush}}"/>
                                            <Setter Property="BorderBrush" 
                                                    TargetName="splitBorder" 
                                                    Value="{DynamicResource ResourceKey={ComponentResourceKey TypeInTargetAssembly={x:Type skin:SkinManager}, ResourceId=TransparentBrush}}"/>
                                        </Trigger>
                                    </ControlTemplate.Triggers>
                                </ControlTemplate>
                            </Setter.Value>
                        </Setter>
                    </Style>
                </ToggleButton.Style>
            </ToggleButton>
            <Border x:Name="Border" 
                    Background="{DynamicResource ResourceKey={ComponentResourceKey TypeInTargetAssembly={x:Type skin:SkinManager}, ResourceId=WhiteBrush}}" 
                    Margin="{TemplateBinding BorderThickness}">
                <TextBox x:Name="PART_EditableTextBox" 
                         HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" 
                         IsReadOnly="{Binding IsReadOnly, RelativeSource={RelativeSource TemplatedParent}}" 
                         Margin="{TemplateBinding Padding}" 
                         VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}">
                    <TextBox.Style>
                        <Style TargetType="{x:Type TextBox}">
                            <Setter Property="OverridesDefaultStyle" Value="True"/>
                            <Setter Property="AllowDrop" Value="True"/>
                            <Setter Property="MinWidth" Value="0"/>
                            <Setter Property="MinHeight" Value="0"/>
                            <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
                            <Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst"/>
                            <Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
                            <Setter Property="Template">
                                <Setter.Value>
                                    <ControlTemplate TargetType="{x:Type TextBox}">
                                        <ScrollViewer x:Name="PART_ContentHost" 
                                                      Background="Transparent" 
                                                      Focusable="False" 
                                                      HorizontalScrollBarVisibility="Hidden" 
                                                      VerticalScrollBarVisibility="Hidden"/>
                                    </ControlTemplate>
                                </Setter.Value>
                            </Setter>
                        </Style>
                    </TextBox.Style>
                </TextBox>
            </Border>
        </Grid>
        <ControlTemplate.Triggers>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="Opacity" TargetName="Border" Value="0.56"/>
            </Trigger>
            <Trigger Property="IsKeyboardFocusWithin" Value="True">
                <Setter Property="Foreground" Value="Black"/>
            </Trigger>
            <Trigger Property="HasItems" Value="False">
                <Setter Property="Height" TargetName="DropDownBorder" Value="95"/>
            </Trigger>
            <Trigger Property="IsGrouping" Value="True">
                <Setter Property="ScrollViewer.CanContentScroll" Value="False"/>
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <ControlTemplate TargetType="{x:Type ubcc:UBConComboBox}" 
                     x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type ubcc:UBConComboBox}, ResourceId=DefaultComboBoxTemplate}">
        <Grid x:Name="templateRoot" SnapsToDevicePixels="True">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="15"/>
            </Grid.ColumnDefinitions>
            <Popup x:Name="PART_Popup" 
                   Placement="Bottom"
                   PopupAnimation="None"
                   Grid.ColumnSpan="2" 
                   IsOpen="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" 
                   Margin="1"
                   VerticalOffset="-4.2"
                   AllowsTransparency="True">
                <Border x:Name="DropDownBorder" 
                        BorderThickness="1"
                        BorderBrush="{DynamicResource ResourceKey={ComponentResourceKey TypeInTargetAssembly={x:Type skin:SkinManager}, ResourceId=DropDownBorderBrush}}"
                        Margin="7"
                        Background="{DynamicResource ResourceKey={ComponentResourceKey TypeInTargetAssembly={x:Type skin:SkinManager}, ResourceId=WhiteBrush}}"
                        MaxHeight="{TemplateBinding MaxDropDownHeight}" 
                        MinWidth="{Binding ActualWidth, ElementName=templateRoot}">
                    <Border.RenderTransform>
                        <TranslateTransform />
                    </Border.RenderTransform>
                    <Grid VerticalAlignment="Top"
                          x:Name="PART_RibbonDropDownButtonResize"
                          MinHeight="32.0">
                        <Grid.RowDefinitions>
                            <RowDefinition />
                            <RowDefinition Height="Auto" />
                        </Grid.RowDefinitions>
                        <Border  Background="{DynamicResource ResourceKey={ComponentResourceKey TypeInTargetAssembly={x:Type skin:SkinManager}, ResourceId=WhiteBrush}}"
                                 Effect="{DynamicResource ResourceKey={ComponentResourceKey TypeInTargetAssembly={x:Type skin:SkinManager}, ResourceId=DropDownShadowEffect}}"
                                 Grid.RowSpan="2"/>
                        <ScrollViewer x:Name="DropDownScrollViewer"
                                      Margin="1">
                            <ItemsPresenter x:Name="ItemsPresenter" KeyboardNavigation.DirectionalNavigation="Contained" 
                                            SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                        </ScrollViewer>
                        <Thumb x:Name="PART_RibbonDropDownButtonThumb" 
                               Grid.Row="1" 
                               Focusable="False" 
                               Visibility="{Binding Path=UserCanResizeDropDown, RelativeSource={RelativeSource Mode=TemplatedParent}, Converter={StaticResource ResourceKey=BooleanConverter}}"
                               Height="7"
                               Style="{DynamicResource ResourceKey={ComponentResourceKey TypeInTargetAssembly={x:Type skin:SkinManager}, ResourceId=DefaulThumbStyle}}"/>
                    </Grid>
                </Border>
            </Popup>
            <ToggleButton x:Name="toggleButton" 
                          BorderBrush="{TemplateBinding BorderBrush}" 
                          BorderThickness="{TemplateBinding BorderThickness}" 
                          Background="{TemplateBinding Background}" 
                          Grid.ColumnSpan="2" 
                          IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}">
                <ToggleButton.Style>
                    <Style TargetType="{x:Type ToggleButton}">
                        <Setter Property="IsTabStop" Value="False"/>
                        <Setter Property="Focusable" Value="False"/>
                        <Setter Property="ClickMode" Value="Press"/>
                        <Setter Property="Template">
                            <Setter.Value>
                                <ControlTemplate TargetType="{x:Type ToggleButton}">
                                    <ubcc:ButtonChrome x:Name="templateRoot" 
                                                        BorderBrush="{TemplateBinding BorderBrush}" 
                                                        BorderThickness="{TemplateBinding BorderThickness}"
                                                        InnerBorderThickness="0"
                                                        SnapsToDevicePixels="True"
                                                        RenderMouseOver="{TemplateBinding IsMouseOver}"
                                                        RenderPressed="{TemplateBinding IsChecked}"
                                                        PressedBorderBrush="{DynamicResource ResourceKey={ComponentResourceKey TypeInTargetAssembly={x:Type skin:SkinManager}, ResourceId=PressedBackgroundBrush}}"
                                                        MouseOverBorderBrush="{DynamicResource ResourceKey={ComponentResourceKey TypeInTargetAssembly={x:Type skin:SkinManager}, ResourceId=PressedBackgroundBrush}}">
                                        <Border x:Name="splitBorder" 
                                                HorizontalAlignment="Right" 
                                                SnapsToDevicePixels="True" 
                                                Width="15">
                                            <Path x:Name="Arrow" 
                                                  Data="M0,4 L 6,4 L 3,8 L 0,4" 
                                                  Fill="{DynamicResource ResourceKey={ComponentResourceKey TypeInTargetAssembly={x:Type skin:SkinManager}, ResourceId=DefaultForegroundBrush}}" 
                                                  HorizontalAlignment="Center" 
                                                  Margin="0, -3, 0, 0" 
                                                  VerticalAlignment="Center"/>
                                        </Border>
                                    </ubcc:ButtonChrome>
                                    <ControlTemplate.Triggers>
                                        <Trigger Property="IsMouseOver" 
                                                 Value="True">
                                            <Setter Property="Fill" 
                                                    TargetName="Arrow" 
                                                    Value="{DynamicResource ResourceKey={ComponentResourceKey TypeInTargetAssembly={x:Type skin:SkinManager}, ResourceId=BlackBrush}}"/>
                                        </Trigger>
                                        <Trigger Property="IsChecked" Value="True">
                                            <Setter Property="Fill" 
                                                    TargetName="Arrow" 
                                                    Value="{DynamicResource ResourceKey={ComponentResourceKey TypeInTargetAssembly={x:Type skin:SkinManager}, ResourceId=BlackBrush}}"/>
                                        </Trigger>
                                        <Trigger Property="IsEnabled" Value="False">
                                            <Setter Property="Fill" 
                                                    TargetName="Arrow" 
                                                    Value="#FFBFBFBF"/>
                                            <Setter Property="Background" TargetName="templateRoot" Value="#FFF0F0F0"/>
                                            <Setter Property="BorderBrush" TargetName="templateRoot" Value="#FFD9D9D9"/>
                                        </Trigger>
                                    </ControlTemplate.Triggers>
                                </ControlTemplate>
                            </Setter.Value>
                        </Setter>
                    </Style>
                </ToggleButton.Style>
            </ToggleButton>
            <ContentPresenter x:Name="ContentSite"
                              Content="{TemplateBinding SelectionBoxItem}"
                              ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}"
                              ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}"
                              ContentStringFormat="{TemplateBinding SelectionBoxItemStringFormat}" 
                              HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" 
                              IsHitTestVisible="False" 
                              Margin="{TemplateBinding Padding}" 
                              SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" 
                              VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
        </Grid>
        <ControlTemplate.Triggers>
            <Trigger Property="HasItems" Value="False">
                <Setter Property="Height" TargetName="PART_RibbonDropDownButtonResize" Value="95"/>
            </Trigger>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="IsGrouping" Value="True"/>
                </MultiTrigger.Conditions>
                <Setter Property="ScrollViewer.CanContentScroll" Value="False"/>
            </MultiTrigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <Style x:Key="{x:Type ubcc:UBConComboBox}" TargetType="{x:Type ubcc:UBConComboBox}">
        <Setter Property="FocusVisualStyle">
            <Setter.Value>
                <Style>
                    <Setter Property="Control.Template">
                        <Setter.Value>
                            <ControlTemplate>
                                <Rectangle Margin="2" SnapsToDevicePixels="True" Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" StrokeThickness="1" StrokeDashArray="1 2"/>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                </Style>
            </Setter.Value>
        </Setter>
        <Setter Property="Background" Value="{DynamicResource ResourceKey={ComponentResourceKey TypeInTargetAssembly={x:Type skin:SkinManager}, ResourceId=WhiteBrush}}"/>
        <Setter Property="BorderBrush" Value="{DynamicResource ResourceKey={ComponentResourceKey TypeInTargetAssembly={x:Type skin:SkinManager}, ResourceId=GalleryBorderBrush}}"/>
        <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.WindowTextBrushKey}}"/>
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
        <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
        <Setter Property="Padding" Value="5,3,5,3"/>
        <Setter Property="ScrollViewer.CanContentScroll" Value="True"/>
        <Setter Property="ScrollViewer.PanningMode" Value="Both"/>
        <Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
        <Style.Triggers>
            <Trigger Property="IsEditable" Value="False">
                <Setter Property="Template" Value="{DynamicResource ResourceKey={ComponentResourceKey TypeInTargetAssembly={x:Type ubcc:UBConComboBox}, ResourceId=DefaultComboBoxTemplate}}"/>
            </Trigger>
            <Trigger Property="IsEditable" Value="True">
                <Setter Property="IsTabStop" Value="False"/>
                <Setter Property="Padding" Value="2"/>
                <Setter Property="Template" Value="{DynamicResource ResourceKey={ComponentResourceKey TypeInTargetAssembly={x:Type ubcc:UBConComboBox}, ResourceId=EditableComboBoxTemplate}}"/>
            </Trigger>
        </Style.Triggers>
    </Style>

    <!--================================ProgressBar Template and Style==============================================-->

    <ControlTemplate x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type ubcc:ProgressBarBase}, ResourceId=DefaultProgressBarBaseTemplate}">
        <ItemsControl ItemsSource="{Binding Path=Items, RelativeSource={RelativeSource Mode=TemplatedParent}}">
            <ItemsControl.ItemsPanel>
                <ItemsPanelTemplate>
                    <Grid />
                </ItemsPanelTemplate>
            </ItemsControl.ItemsPanel>
        </ItemsControl>
    </ControlTemplate>

    <Style TargetType="{x:Type ubcc:ProgressBarBase}"
           x:Key="{x:Type ubcc:ProgressBarBase}">
        <Setter Property="Template" Value="{DynamicResource ResourceKey={ComponentResourceKey TypeInTargetAssembly={x:Type ubcc:ProgressBarBase}, ResourceId=DefaultProgressBarBaseTemplate}}" />
    </Style>

    <ControlTemplate x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type ubcc:DatePicker}, ResourceId=DefaultDatePickerTemplate}"
                     TargetType="{x:Type ubcc:DatePicker}">
        <Grid>

        </Grid>
    </ControlTemplate>

    <Style TargetType="{x:Type ubcc:DatePicker}"
           x:Key="{x:Type ubcc:DatePicker}">
        <Setter Property="Template" Value="{DynamicResource ResourceKey={ComponentResourceKey TypeInTargetAssembly={x:Type ubcc:DatePicker}, ResourceId=DefaultDatePickerTemplate}}" />
    </Style>


    <!--================================MessageBoxControl Template and Style==============================================-->

    <Thickness x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type skin:SkinManager}, ResourceId=WindowBorderThickness}">1</Thickness>

    <BitmapImage x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type skin:SkinManager}, ResourceId=ErrorImage}">pack://application:,,,/UBCon.Resources;component/Images/Error.png</BitmapImage>
    <BitmapImage x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type skin:SkinManager}, ResourceId=QuestionImage}">pack://application:,,,/UBCon.Resources;component/Images/Question.png</BitmapImage>
    <BitmapImage x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type skin:SkinManager}, ResourceId=InformationImage}">pack://application:,,,/UBCon.Resources;component/Images/Information.png</BitmapImage>
    <BitmapImage x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type skin:SkinManager}, ResourceId=CriticalImage}">pack://application:,,,/UBCon.Resources;component/Images/Critical.png</BitmapImage>
    <BitmapImage x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type skin:SkinManager}, ResourceId=WarningImage}">pack://application:,,,/UBCon.Resources;component/Images/Warning.png</BitmapImage>

    <!--Close button template-->
    <ControlTemplate x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type ubcc:MessageBoxControl}, ResourceId=CloseButtonTemplate}"
                     TargetType="{x:Type Button}">
        <ubcc:ButtonChrome   InnerBorderCornerRadius="0" 
                            InnerBorderThickness="0"  
                            BorderThickness="0"
                            BorderBrush="{DynamicResource ResourceKey={ComponentResourceKey TypeInTargetAssembly={x:Type skin:SkinManager}, ResourceId=TransparentBrush}}" 
                            Background="{DynamicResource ResourceKey={ComponentResourceKey TypeInTargetAssembly={x:Type skin:SkinManager}, ResourceId=TransparentBrush}}"  
                            RenderMouseOver="{TemplateBinding IsMouseOver}"
                            RenderPressed="{TemplateBinding IsPressed}"
                            HorizontalContentAlignment="Center"
                            VerticalContentAlignment="Center">
            <Image  Stretch="None"
                    x:Name="CloseButton_Image"
                    Source="{DynamicResource ResourceKey={ComponentResourceKey TypeInTargetAssembly={x:Type skin:SkinManager}, ResourceId=NormalStateImage}}"/>
        </ubcc:ButtonChrome>
        <ControlTemplate.Triggers>
            <Trigger Property="IsMouseOver" Value="True">
                <Setter Property="Source" Value="{DynamicResource ResourceKey={ComponentResourceKey TypeInTargetAssembly={x:Type skin:SkinManager}, ResourceId=MouseOverStateImage}}" 
                        TargetName="CloseButton_Image"/>
            </Trigger>
            <Trigger Property="IsPressed" Value="True">
                <Setter Property="Source" Value="{DynamicResource ResourceKey={ComponentResourceKey TypeInTargetAssembly={x:Type skin:SkinManager}, ResourceId=PressedStateImage}}"  
                        TargetName="CloseButton_Image"/>
            </Trigger>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="Source" Value="{DynamicResource ResourceKey={ComponentResourceKey TypeInTargetAssembly={x:Type skin:SkinManager}, ResourceId=DisabledStateImage}}"  
                        TargetName="CloseButton_Image"/>
            </Trigger>

        </ControlTemplate.Triggers>
    </ControlTemplate>

    <!--Close button style-->
    <Style TargetType="{x:Type Button}" 
           x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type ubcc:MessageBoxControl}, ResourceId=CloseButtonStyle}">
        <Setter Property="Width" Value="28"/>
        <Setter Property="Height" Value="25"/>
        <Setter Property="Focusable" Value="False"/>
        <Setter Property="Margin" Value="0,0,1,0"/>
        <Setter Property="Template" Value="{DynamicResource ResourceKey={ComponentResourceKey TypeInTargetAssembly={x:Type ubcc:MessageBoxControl}, ResourceId=CloseButtonTemplate}}"/>
    </Style>

    <Style TargetType="{x:Type Button}"
           x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type ubcc:MessageBoxControl}, ResourceId=ButtonStyle}">
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="BorderBrush" Value="{DynamicResource ResourceKey={ComponentResourceKey TypeInTargetAssembly={x:Type skin:SkinManager}, ResourceId=LightGrayBrush}}"/>
        <Setter Property="Background" Value="{DynamicResource ResourceKey={ComponentResourceKey TypeInTargetAssembly={x:Type skin:SkinManager}, ResourceId=WhiteBrush}}"/>
        <Setter Property="Focusable" Value="True"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Button}">
                    <ubcc:ButtonChrome RenderMouseOver="{TemplateBinding IsMouseOver}"
                                            RenderPressed="{TemplateBinding IsPressed}"
                                            BorderThickness="{TemplateBinding BorderThickness}"
                                            Content="{TemplateBinding Content}"
                                            Background="{TemplateBinding Background}"
                                            BorderBrush="{TemplateBinding BorderBrush}"
                                            MouseOverBorderBrush="{DynamicResource ResourceKey={ComponentResourceKey TypeInTargetAssembly={x:Type skin:SkinManager}, ResourceId=MouseOverBorderBrush}}"
                                            PressedBorderBrush="{DynamicResource ResourceKey={ComponentResourceKey TypeInTargetAssembly={x:Type skin:SkinManager}, ResourceId=MouseOverMenuBackgroundBrush}}"
                                            PressedBackgroundBrush="{DynamicResource ResourceKey={ComponentResourceKey TypeInTargetAssembly={x:Type skin:SkinManager}, ResourceId=PressedBackgroundBrush}}"
                                            HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
                                            VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsFocused" Value="True">
                            <Setter Property="BorderBrush" Value="{DynamicResource ResourceKey={ComponentResourceKey TypeInTargetAssembly={x:Type skin:SkinManager}, ResourceId=GrayBrush}}"/>
                            <Setter Property="BorderThickness" Value="1.2"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>


    <ControlTemplate x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type ubcc:MessageBoxControl}, ResourceId=DefaultMessageBoxControlTemplate}"
                     TargetType="{x:Type ubcc:MessageBoxControl}">
        <Border BorderThickness="{TemplateBinding BorderThickness}" 
                CornerRadius="0" 
                x:Name="PART_OuterBorder"
                Background="{TemplateBinding Background}"
                BorderBrush="{TemplateBinding BorderBrush}" 
                IsHitTestVisible="True" 
                Margin="0"
                VerticalAlignment="Center"
                MinHeight="{TemplateBinding MinHeight}"
                MinWidth="{TemplateBinding MinWidth}"
                MaxHeight="{TemplateBinding MaxHeight}"
                MaxWidth="{TemplateBinding MaxWidth}">
            <Grid x:Name="PART_RootPanel" 
                  >
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="Auto" />
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="29" x:Name="titleRow"/>
                    <RowDefinition Height="*" />
                    <RowDefinition Height="48" />
                </Grid.RowDefinitions>
                <TextBlock HorizontalAlignment="Stretch"
                           VerticalAlignment="Center"
                           Text="{TemplateBinding Title}"
                           x:Name="PART_TitleText"
                           TextTrimming="CharacterEllipsis"
                           Grid.IsSharedSizeScope="True"
                           TextAlignment="Center"/>
                <Button x:Name="CloseButton" 
                        Style="{DynamicResource ResourceKey={ComponentResourceKey TypeInTargetAssembly={x:Type ubcc:MessageBoxControl}, ResourceId=CloseButtonStyle}}"
                        Command="{x:Static ubcc:MessageBoxControl.CloseCommand}"
                        Grid.Column="1" 
                        HorizontalAlignment="Right" 
                        VerticalAlignment="Center"
                        IsEnabled="{TemplateBinding IsCloseButtonEnabled}"/>
                <Grid Grid.Row="1"
                      Grid.ColumnSpan="2">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition Width="*" />
                    </Grid.ColumnDefinitions>
                    <Image Margin="7,0,5,20"
                           HorizontalAlignment="Center"
                           VerticalAlignment="Top"
                           Width="44"
                           Height="44"
                           x:Name="PART_Image"/>
                    <TextBlock    Grid.Column="1" 
                                  Text="{TemplateBinding Content}"
                                  Margin="3,0,44,20"
                                  VerticalAlignment="Center"
                                  TextAlignment="Left"
                                  TextWrapping="Wrap"/>
                </Grid>
                <Border Grid.Row="2"
                        Grid.ColumnSpan="2"
                        Background="{DynamicResource ResourceKey={ComponentResourceKey TypeInTargetAssembly={x:Type skin:SkinManager}, ResourceId=MessageBoxFooterBackground}}"
                        BorderThickness="0,1,0,0"
                        BorderBrush="{DynamicResource ResourceKey={ComponentResourceKey TypeInTargetAssembly={x:Type skin:SkinManager}, ResourceId=MessageBoxFooterBorderBrush}}">
                    <StackPanel HorizontalAlignment="Center"
                                VerticalAlignment="Center"
                                Orientation="Horizontal"
                                x:Name="PART_ButtonsPanel"
                                KeyboardNavigation.DirectionalNavigation="Cycle"
                                KeyboardNavigation.TabNavigation="Cycle"
                                KeyboardNavigation.ControlTabNavigation="None"/>
                </Border>
            </Grid>
        </Border>
        <ControlTemplate.Triggers>
            <Trigger Property="MessageBoxImage" Value="Asterisk">
                <Setter Property="Source" Value="{DynamicResource ResourceKey={ComponentResourceKey TypeInTargetAssembly={x:Type skin:SkinManager}, ResourceId=WarningImage}}"
                        TargetName="PART_Image"/>
            </Trigger>
            <Trigger Property="MessageBoxImage" Value="Error">
                <Setter Property="Source" Value="{DynamicResource ResourceKey={ComponentResourceKey TypeInTargetAssembly={x:Type skin:SkinManager}, ResourceId=CriticalImage}}"
                        TargetName="PART_Image"/>
            </Trigger>
            <Trigger Property="MessageBoxImage" Value="Exclamation">
                <Setter Property="Source" Value="{DynamicResource ResourceKey={ComponentResourceKey TypeInTargetAssembly={x:Type skin:SkinManager}, ResourceId=ErrorImage}}"
                        TargetName="PART_Image"/>
            </Trigger>
            <Trigger Property="MessageBoxImage" Value="Hand">
                <Setter Property="Source" Value="{DynamicResource ResourceKey={ComponentResourceKey TypeInTargetAssembly={x:Type skin:SkinManager}, ResourceId=HandImage}}"
                        TargetName="PART_Image"/>
            </Trigger>
            <Trigger Property="MessageBoxImage" Value="Information">
                <Setter Property="Source" Value="{DynamicResource ResourceKey={ComponentResourceKey TypeInTargetAssembly={x:Type skin:SkinManager}, ResourceId=InformationImage}}"
                        TargetName="PART_Image"/>
            </Trigger>
            <Trigger Property="MessageBoxImage" Value="Question">
                <Setter Property="Source" Value="{DynamicResource ResourceKey={ComponentResourceKey TypeInTargetAssembly={x:Type skin:SkinManager}, ResourceId=QuestionImage}}"
                        TargetName="PART_Image"/>
            </Trigger>

            <Trigger Property="MessageBoxImage" Value="Stop">
                <Setter Property="Source" Value="{DynamicResource ResourceKey={ComponentResourceKey TypeInTargetAssembly={x:Type skin:SkinManager}, ResourceId=CriticalImage}}"
                        TargetName="PART_Image"/>
            </Trigger>

            <Trigger Property="MessageBoxImage" Value="Warning">
                <Setter Property="Source" Value="{DynamicResource ResourceKey={ComponentResourceKey TypeInTargetAssembly={x:Type skin:SkinManager}, ResourceId=WarningImage}}"
                        TargetName="PART_Image"/>
            </Trigger>

        </ControlTemplate.Triggers>
    </ControlTemplate>

    <Style x:Key="{x:Type ubcc:MessageBoxControl}" TargetType="{x:Type ubcc:MessageBoxControl}">
        <Setter Property="SizeToContent" Value="WidthAndHeight"/>
        <Setter Property="ResizeMode" Value="NoResize"/>
        <Setter Property="Background" Value="{DynamicResource ResourceKey={ComponentResourceKey TypeInTargetAssembly={x:Type skin:SkinManager}, ResourceId=WindowBackgroundBrush}}"/>
        <Setter Property="BorderThickness" Value="{DynamicResource ResourceKey={ComponentResourceKey TypeInTargetAssembly={x:Type skin:SkinManager}, ResourceId=WindowBorderThickness}}" />
        <Setter Property="BorderBrush" Value="{DynamicResource ResourceKey={ComponentResourceKey TypeInTargetAssembly={x:Type skin:SkinManager}, ResourceId=RibbonWindowBorderBrush}}"/>
        <Setter Property="MinHeight" Value="100"/>
        <Setter Property="MinWidth" Value="300"/>
        <Setter Property="DefaultButtonStyle" Value="{DynamicResource ResourceKey={ComponentResourceKey TypeInTargetAssembly={x:Type ubcc:MessageBoxControl}, ResourceId=ButtonStyle}}"/>
        <!--<Setter Property="YesButtonStyle" Value="{DynamicResource ResourceKey={ComponentResourceKey TypeInTargetAssembly={x:Type ubcc:MessageBoxWindow}, ResourceId=YesButtonStyle}}"/>
        <Setter Property="NoButtonStyle" Value="{DynamicResource ResourceKey={ComponentResourceKey TypeInTargetAssembly={x:Type ubcc:MessageBoxWindow}, ResourceId=NoButtonStyle}}"/>
        <Setter Property="CancelButtonStyle" Value="{DynamicResource ResourceKey={ComponentResourceKey TypeInTargetAssembly={x:Type ubcc:MessageBoxWindow}, ResourceId=CancelButtonStyle}}"/>
        <Setter Property="OKButtonStyle" Value="{DynamicResource ResourceKey={ComponentResourceKey TypeInTargetAssembly={x:Type ubcc:MessageBoxWindow}, ResourceId=OKButtonStyle}}"/>-->
        <Setter Property="Template" Value="{DynamicResource ResourceKey={ComponentResourceKey TypeInTargetAssembly={x:Type ubcc:MessageBoxControl}, ResourceId=DefaultMessageBoxControlTemplate}}"/>
    </Style>

    <!--================================Calendar Template and Style==============================================-->

    <ControlTemplate x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type ubcc:Calendar}, ResourceId=DefaultCalendarTemplate}"
                     TargetType="{x:Type ubcc:Calendar}">
        <Border BorderBrush="{TemplateBinding BorderBrush}"
                Background="{TemplateBinding Background}"
                BorderThickness="{TemplateBinding BorderThickness}">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition />
                </Grid.RowDefinitions>
                <Grid />
                <Grid Grid.Row="1" />
                <Grid Grid.Row="2"/>
            </Grid>
        </Border>
    </ControlTemplate>

    <Style x:Key="{x:Type ubcc:Calendar}" TargetType="{x:Type ubcc:Calendar}">
        <Setter Property="BorderBrush" Value="Beige"/>
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="Template" Value="{DynamicResource ResourceKey={ComponentResourceKey TypeInTargetAssembly={x:Type ubcc:Calendar}, ResourceId=DefaultCalendarTemplate}}"/>
    </Style>

    <!--================================WaterMarkTextBox Template and Style==============================================-->

    <Style x:Key="{x:Type ubcc:WaterMarkTextBox}" TargetType="{x:Type ubcc:WaterMarkTextBox}">
        <Setter Property="SnapsToDevicePixels" Value="True"/>
        <Setter Property="KeyboardNavigation.TabNavigation" Value="None"/>
        <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
        <Setter Property="MinWidth" Value="120"/>
        <Setter Property="MinHeight" Value="20"/>
        <Setter Property="AllowDrop" Value="true"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ubcc:WaterMarkTextBox}">
                    <Border 
                              Name="Border"
                              CornerRadius="0" 
                              Padding="2"
                              Background="{DynamicResource ResourceKey={ComponentResourceKey TypeInTargetAssembly={x:Type skin:SkinManager}, ResourceId=WhiteBrush}}"
                              BorderBrush="{DynamicResource ResourceKey={ComponentResourceKey TypeInTargetAssembly={x:Type skin:SkinManager}, ResourceId=LightGrayBrush}}"
                              BorderThickness="1" >
                        <Grid >
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition />
                                <ColumnDefinition Width="Auto" />
                            </Grid.ColumnDefinitions>
                            <ScrollViewer Margin="0" x:Name="PART_ContentHost"/>
                            <TextBlock Margin="2" 
                                       Text="{TemplateBinding WatermarkText}"
                                       x:Name="watermark"
                                       Opacity="0.85"
                                       VerticalAlignment="Center"
                                       Foreground="{DynamicResource ResourceKey={ComponentResourceKey TypeInTargetAssembly={x:Type skin:SkinManager}, ResourceId=GrayBrush}}"/>
                            <Button x:Name="ClearButton" 
                                    Width="15"
                                    Height="15"
                                    Grid.Column="1"
                                    Command="{TemplateBinding ClearTextCommand}">
                                <Button.Style>
                                    <!--Clear button style-->
                                    <Style TargetType="{x:Type Button}" >
                                        <Setter Property="Template">
                                            <Setter.Value>
                                                <ControlTemplate TargetType="{x:Type Button}">
                                                    <ubcc:ButtonChrome   InnerBorderCornerRadius="0" 
                                                                        InnerBorderThickness="0"  
                                                                        BorderThickness="0"
                                                                        BorderBrush="{DynamicResource ResourceKey={ComponentResourceKey TypeInTargetAssembly={x:Type skin:SkinManager}, ResourceId=TransparentBrush}}" 
                                                                        Background="{DynamicResource ResourceKey={ComponentResourceKey TypeInTargetAssembly={x:Type skin:SkinManager}, ResourceId=TransparentBrush}}"  
                                                                        RenderMouseOver="{TemplateBinding IsMouseOver}"
                                                                        RenderPressed="{TemplateBinding IsPressed}"
                                                                        HorizontalContentAlignment="Center"
                                                                        VerticalContentAlignment="Center">
                                                        <Image  Stretch="Fill"
                                                                x:Name="CloseButton_Image"
                                                                Source="{DynamicResource ResourceKey={ComponentResourceKey TypeInTargetAssembly={x:Type skin:SkinManager}, ResourceId=NormalStateImage}}"
                                                                Width="8"
                                                                Height="8"/>
                                                    </ubcc:ButtonChrome>
                                                    <ControlTemplate.Triggers>
                                                        <Trigger Property="IsMouseOver" Value="True">
                                                            <Setter Property="Source" Value="{DynamicResource ResourceKey={ComponentResourceKey TypeInTargetAssembly={x:Type skin:SkinManager}, ResourceId=MouseOverStateImage}}" 
                        TargetName="CloseButton_Image"/>
                                                        </Trigger>
                                                        <Trigger Property="IsPressed" Value="True">
                                                            <Setter Property="Source" Value="{DynamicResource ResourceKey={ComponentResourceKey TypeInTargetAssembly={x:Type skin:SkinManager}, ResourceId=PressedStateImage}}"  
                        TargetName="CloseButton_Image"/>
                                                        </Trigger>
                                                        <Trigger Property="IsEnabled" Value="False">
                                                            <Setter Property="Source" Value="{DynamicResource ResourceKey={ComponentResourceKey TypeInTargetAssembly={x:Type skin:SkinManager}, ResourceId=DisabledStateImage}}"  
                        TargetName="CloseButton_Image"/>
                                                        </Trigger>

                                                    </ControlTemplate.Triggers>
                                                </ControlTemplate>
                                            </Setter.Value>
                                        </Setter>
                                    </Style>
                                </Button.Style>
                            </Button>
                        </Grid>

                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter TargetName="Border" Property="BorderBrush" Value="{DynamicResource ResourceKey={ComponentResourceKey TypeInTargetAssembly={x:Type skin:SkinManager}, ResourceId=MouseOverBackgroundBrush}}"/>
                        </Trigger>
                        <Trigger Property="IsKeyboardFocused" Value="True">
                            <Setter TargetName="Border" Property="BorderBrush" Value="{DynamicResource ResourceKey={ComponentResourceKey TypeInTargetAssembly={x:Type skin:SkinManager}, ResourceId=PressedBackgroundBrush}}"/>
                            <Setter Property="Visibility" Value="Collapsed" TargetName="watermark"/>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter TargetName="Border" Property="Background" Value="{DynamicResource ResourceKey={ComponentResourceKey TypeInTargetAssembly={x:Type skin:SkinManager}, ResourceId=GrayBrush}}"/>
                            <Setter TargetName="Border" Property="BorderBrush" Value="{DynamicResource ResourceKey={ComponentResourceKey TypeInTargetAssembly={x:Type skin:SkinManager}, ResourceId=LightGrayBrush}}"/>
                            <Setter Property="Foreground" Value="{DynamicResource ResourceKey={ComponentResourceKey TypeInTargetAssembly={x:Type skin:SkinManager}, ResourceId=LightGrayBrush}}"/>
                        </Trigger>
                        <Trigger Property="HasText" Value="True">
                            <Setter Property="Visibility" Value="Collapsed" TargetName="watermark"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>